<?php ob_start();?>
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="format-detection" content="telephone=no">
	<link href="<?php echo TEMPLATE_SITE_URL;?>/css/index.css" rel="stylesheet" type="text/css">
    <link href="<?php echo TEMPLATE_SITE_URL;?>/css/common.css" rel="stylesheet" type="text/css">
    <title><?php echo $output['site_name']?></title>
    <style>
		.saleMain {
			position: relative;
			width: 94%;
			margin: 0 3%;
			margin-top: 10px;
		}
	</style>
</head>
<body>

<div id="pop4" class="concernDiv" style="display: none;">
  <div class="concern">
  	<p class="conTitle1" style="text-align:center;"><span>您的拍品确认<font class="showword" is_show="1">隐藏</font>？</span></p>
  	<input type="hidden" name="show_id">
  	<a class="whiteBn shauction">确认</a>
  	<a class="greyBn">取消</a>
  </div>
</div>

<div id="pop3" class="concernDiv" style="display: none;">
  <div class="concern">
  	<p class="conTitle1" style="text-align:center;"><span>您的拍品确认下架？</span></p>
  	<input type="hidden" name="xiajia_id">
  	<a class="whiteBn xiajiapaipin">确认</a>
  	<a class="greyBn">取消</a>
  </div>
</div>

<div id="pop2" class="concernDiv" style="display: none;">
  <div class="concern">
  	<p class="conTitle" style="text-align:left;">亲，关注我们才能出价!</p>
  	<a class="whiteBn" href="<?php echo $output['guanzhu_link'];?>">关注<?php echo $output['site_name']?></a><a class="greyBn">取消</a>
  </div>
</div>

<div id="pop" style="display: none;">
	<img src="<?php echo TEMPLATE_SITE_URL;?>/images/poping.png" width="250" height="150">
</div>
<div id="contentbox">
    <div class="head">
			<div class="headLink"><a href="javascript:;" class="on">关注</a><a href="index.php?act=jingxuan">精选</a><div class="new" style="left:100px;top:-5px;">NEW</div></div>
    		<div class="newCamera publish"><img src="<?php echo TEMPLATE_SITE_URL;?>/images/headercamera.png" width="25" height="18"></div>
    		<!-- 
            <div class="name"><?php echo $output['user']['nickname'];?></div>
            <div class="avatar">
                <a href="index.php?act=my&op=home&uid=<?php echo $output['user']['user_id'];?>">
                    <img src="<?php echo $output['user']['avatar'];?>">
                </a>
            </div>
            <div class="tip">
            	<?php if(!empty($output['user']['signature'])){?>
            	<?php echo $output['user']['signature'];?>
            	<?php }else{?>
            	<?php echo $output['site_name'];?>，展示已订阅的卖家拍品
            	<?php }?>            	
            </div> -->
    </div>

<?php if($output['count']=='0'){?>
<div class="saleMain" style="min-height:300px">
	<div class="noSale">
	          <p class="camera"><a href="index.php?act=index&op=yao"><img src="<?php echo TEMPLATE_SITE_URL;?>/images/text.png" width="175" height="107"></a><br></p>
    </div>
</div>
<?php }else{?>
<div class="saleMain" style="min-height:300px"></div>
<div class="loadNextPage" style="color:#777;text-align:center;font-size:13px;display:none;">
	<div class="loading" id="nextpage" style="width:100px;height:40px;margin-left:auto;margin-right:auto">
		<img src="<?php echo TEMPLATE_SITE_URL;?>/images/loadingData.gif" style="float:left">
		<span style="float:left;margin-top:10px;">加载拍卖</span>
	</div>
</div>
<?php }?>

<input type="hidden" name="pagenum" value="1" id="pagenum">
<input type="hidden" name="totalpage" value="<?php echo $output["totalpage"];?>" id="totalpage">

<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/zepto.js" charset="utf-8"></script>
<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/touch.js" charset="utf-8"></script>
<script type="text/javascript">

$(function(){	
    $(window).scroll(function () {
        var $body = $("body");
        if (($(window).height() + $(window).scrollTop()) >= $body.height()) {
    		var pagenum = parseInt($('#pagenum').val());
    		var nextpage = eval(pagenum+1);
    		var totalpage = parseInt($('#totalpage').val());
    		
    		if(pagenum>=totalpage){
    			$('#nextpage').hide();
    		}
    		$('#pagenum').val(nextpage);    		
    		dataajax();		
        }
    });
    
	$('.shauction').click(function(){
		var auction_id = $('input[name=show_id]').val();
		var is_show = $('.showword').attr('is_show');
		
		$.ajax({
			type:'get',
			url:'index.php?act=my&op=updateshow',
			data:{auction_id:auction_id,is_show:is_show},
			dataType:'json',
			success:function(data){
				if(data.state == 1){
					location.reload();
				}				
			}
		});
		return false;	
	});
	
	
	$('.xiajiapaipin').click(function(){
		var auction_id = $('input[name=xiajia_id]').val();
		var state = '1';
		$.ajax({
			type:'get',
			url:'index.php?act=my&op=updatestate',
			data:{auction_id:auction_id,is_state:state},
			dataType:'json',
			success:function(data){
				if(data.state == 1){
					location.reload();
				}				
			}
		});
		return false;		
	});
	
	$('.greyBn').click(function(){
		$('#pop2').hide();
		$('#pop3').hide();
		$('#pop4').hide();
	});
	
	function dataajax(){
		var pagenum = $('#pagenum').val();
		var user_id = <?php echo intval($_GET['user_id']);?>;
		var seller_id = <?php echo intval($_GET['seller_id']);?>;
		var auction_id = <?php if(isset($_GET['auction_id'])){ echo $_GET['auction_id'];}else{ echo '0';}?>;
		$.ajax({
			type:'get',
			url:'index.php?act=index&op=auctionajax',
			data:{user_id:user_id,seller_id:seller_id,auction_id:auction_id,pagenum:pagenum},
			dataType:'html',
			success:function(html){
				$('.loadNextPage').hide();
				$('.saleMain').append(html);


				$('.bidBtngre').click(function(){
					var auction_id = $(this).attr('bidauction');
					ajaxauctionprice(auction_id);

				});

				$(".close").click(function(){
					$('.fixednumMain').empty();
				});

				$('.likeIt').click(function(){
					var auction_id = $(this).attr('like_auction_id');
					var res = ajaxlike(auction_id);	
					$(this).removeClass('likeIt');
					$(this).addClass('liked');					
				});

				$('.xiajia').click(function(){
					var auction_id = $(this).attr('auction_id');
					$('input[name=xiajia_id]').val(auction_id);
					$('#pop3').show();
				});

				$('.showauction').click(function(){
					var auction_id = $(this).attr('auction_id');

					$('input[name=show_id]').val(auction_id);
					$('.showword').html('显示');
					$('.showword').attr('is_show','0');
					$('#pop4').show();
				});

				$('.hideauction').click(function(){
					var auction_id = $(this).attr('auction_id');
					
					$('input[name=show_id]').val(auction_id);	
					$('.showword').html('隐藏');	
					$('.showword').attr('is_show','1');			
					$('#pop4').show();
				});

				$('.guanzhu').click(function(){
			  		var uid = '<?php echo $_COOKIE['user_id']?>';
			  		var fid = $(this).attr('seller_id');
			  		$.ajax({
			  			type:'get',
			  			url:'index.php?act=my&op=guanzhu',
			  			data:{uid:uid,fid:fid},
			  			dataType:'json',
			  			success:function(data){
			  				location.reload();
			  			}
			  		});
				});

				$('.logmore').click(function(){
					var auction_id = $(this).attr('auction_id');
					$(".loglist"+auction_id).show();
					$(this).hide();
				});


				$('.quan').click(function(){
					var auction_id = $(this).data('auction_id');
					
					$('.showdesc'+auction_id).css("overflow","visible");	
					$('.showdesc'+auction_id).height(''); 
					$(".quanwen"+auction_id).hide();
					
				});

				$('.fenxiang1').click(function(){
					  $('#pop').show();
					  var auction_id = $(this).attr('auction_id');
					  var title = '【'+$(this).attr('nickname')+'】的<?php echo $output['site_name'];?>拍卖开拍啦！';
					  var desc = $(this).attr('auction_description');
					  var link = $(this).attr('auction_link'); 
					  var imgUrl1 = $(this).attr('imgurl'); 
				 	  wx.onMenuShareAppMessage({
					    title: title,
					    desc: desc,
					    link: link,
					    imgUrl: imgUrl1,
					    trigger: function (res) {
					      //alert('用户点击发送给朋友');
					    },
					    success: function (res) {
					      $.ajax({
							type:'get',
							url:'index.php?act=index&op=share',
							data:{auction_id:auction_id},
							success:function(){
								return false;
							}
						  });
					      $('#pop').hide();
					    },
					    cancel: function (res) {
					      $('#pop').hide();
					      //alert('已取消');
					    },
					    fail: function (res) {
					      	//alert(JSON.stringify(res));
					    }
					  });


				 		wx.onMenuShareTimeline({
						    title: desc,
						    link: link,
						    imgUrl: imgUrl1,
				 		    success: function () { 
			 			      $.ajax({
			 					type:'get',
			 					url:'index.php?act=index&op=share',
			 					data:{auction_id:auction_id},
			 					success:function(){
			 						return false;
			 					}
			 				  });
			 			      $('#pop').hide();
				 		        // 用户确认分享后执行的回调函数
				 		    },
				 		    cancel: function () { 
				 		    	$('#pop').hide();
				 		        // 用户取消分享后执行的回调函数
				 		    }
				 		});
					  
					});
				
				$('.fenxiang').click(function(){
					  $('#pop').show();
					  var auction_id = $(this).attr('auction_id');
					  var title = '【'+$(this).attr('nickname')+'】的<?php echo $output['site_name'];?>拍卖开拍啦！';
					  var desc = $(this).attr('auction_description');
					  var link = $(this).attr('auction_link'); 
					  var imgUrl = $(this).attr('imgurl'); 
				 	  wx.onMenuShareAppMessage({
					    title: title,
					    desc: desc,
					    link: link,
					    imgUrl: imgUrl,
					    trigger: function (res) {
					      //alert('用户点击发送给朋友');
					    },
					    success: function (res) {
					      $.ajax({
								type:'get',
								url:'index.php?act=index&op=share',
								data:{auction_id:auction_id},
								success:function(){
									return false;
								}
							  });
					      $('#pop').hide();
					    },
					    cancel: function (res) {
					      $('#pop').hide();
					      //alert('已取消');
					    },
					    fail: function (res) {
					      	//alert(JSON.stringify(res));
					    }
					  });

				 		wx.onMenuShareTimeline({
						    title: desc,
						    link: link,
						    imgUrl: imgUrl1,
				 		    success: function () { 
			 			      $.ajax({
			 					type:'get',
			 					url:'index.php?act=index&op=share',
			 					data:{auction_id:auction_id},
			 					success:function(){
			 						return false;
			 					}
			 				  });
			 			      $('#pop').hide();
				 		        // 用户确认分享后执行的回调函数
				 		    },
				 		    cancel: function () { 
				 		    	$('#pop').hide();
				 		        // 用户取消分享后执行的回调函数
				 		    }
				 		});
					  
					});
			},
			beforeSend:function(){
				$('.loadNextPage').show();
			}
		});
	}

	function ajaxlike(auction_id){
		var user_id = <?php echo $_COOKIE['user_id'];?>;
		$.ajax({
			type:'get',
			url:'index.php?act=index&op=like',
			data:{user_id:user_id,auction_id:auction_id},
			dataType:'json',
			success:function(data){
				if(data.state == 1){
					$('img[like_img_auction_id="'+auction_id+'"]').show();
					$('div[like_div_auction_id="'+auction_id+'"]').show();
					var likenum = $('div[like_auction_id="'+auction_id+'"]').html();
					$('div[like_auction_id="'+auction_id+'"]').html(parseInt(likenum)+1);
					var html = '<a href="index.php?act=my&op=home&user_id='+data.data.user_id+'" class="likeAvatar" style="background-image: url('+data.data.avatar+')"></a>';              

					$('label[auctionavatar="'+auction_id+'"]').append(html);
					return true;				
				}else{
					return false;
				}
				
			}
		});
	}
	
	function ajaxauctionprice(auction_id){
		var user_id = '<?php echo $_COOKIE['user_id']?>';
		var mobile = '<?php echo $output['user']['mobile']?>';
		var isauth = '<?php echo $output['user']['isauth']?>';
		var subscribe = '<?php echo $output['user']['subscribe']?>';

		if(subscribe!='1'){
			$.ajax({
				type:'get',
				url:'index.php?act=my&op=popguanzhu',
				data:{auction_id:auction_id},
				dataType:'json',
				success:function(){
					return false;
				}
			});
			$('#pop2').show();
			return false;
		}
		
		if(isauth!='1'){
			location.href = 'index.php?act=index&op=mobile&auction_id='+auction_id;
			return false;
		}
		
		$.ajax({
			type:'get',
			url:'index.php?act=index&op=auctionaddprice',
			data:{auction_id:auction_id,user_id:user_id},
			dataType:'html',
			success:function(html){
				$('.fixednumMain').empty();
				$('.fixednumMain').html(html);	
			}
		});
		$('.fixednumMain').show();
	}
	dataajax();
});
</script>
<script type='text/javascript'>
	$(function(){

		
		
		var time = parseInt("<?php echo TIMESTAMP;?>");
		$('.process').each(function(){
			var lag = parseInt($(this).attr('endtime')) - time;
			if(lag>0){
			   var second = Math.floor(lag % 60);    
			   var minite = Math.floor((lag / 60) % 60);
			   var hour = Math.floor((lag / 3600) % 24);
			   var day = Math.floor((lag / 3600) / 24);
			   $(this).html('<span style="color:#910012;font-size:16px;">&nbsp;'+day+'&nbsp;</span>'+'<?php echo $lang['bearshop_day'];?>'+'<span style="color:#910012;font-size:16px;">&nbsp;'+hour+'&nbsp;</span>'+'<?php echo $lang['bearshop_hour'];?>'+'<span style="color:#910012;font-size:16px;">&nbsp;'+minite+"&nbsp;</span>"+'<?php echo $lang['bearshop_minute'];?>'+'<span style="color:#910012;font-size:16px;">'+second+'</span>');
			}
		});
		function updateEndTime(){
			time++;		
			$(".process").each(function(){
				var lag = parseInt($(this).attr('endTime')) - time;
				if(lag>0){
				    var second = Math.floor(lag % 60);    
				    var minite = Math.floor((lag / 60) % 60);
				    var hour = Math.floor((lag / 3600) % 24);
				    var day = Math.floor((lag / 3600) / 24);
					$(this).html('<span style="color:#910012;font-size:16px;">&nbsp;'+day+'&nbsp;</span>'+'<?php echo $lang['bearshop_day'];?>'+'<span style="color:#910012;font-size:16px;">&nbsp;'+hour+'&nbsp;</span>'+'<?php echo $lang['bearshop_hour'];?>'+'<span style="color:#910012;font-size:16px;">&nbsp;'+minite+"&nbsp;</span>"+'<?php echo $lang['bearshop_minute'];?>'+'<span style="color:#910012;font-size:16px;">&nbsp;'+second+'&nbsp;</span>');
				}else{
					var aid = $(this).attr('aid');
					var html = '<div class="saleEndBtn">'+$(this).attr('con')+'&nbsp;拍卖结束 </div>';
					$('div[cur="'+aid+'"]').remove();
					$('div[bidaid="'+aid+'"]').html(html);
				}
			});
			setTimeout(updateEndTime,1000);
		}
		setTimeout(updateEndTime,1000);
	});
</script>
<?php include template('home/nav');?>
<div class="fixednumMain" style="display: none; bottom: 0px;"></div>

</body>
</html>




